<?php /* Widget Title: Top Users */ ?>

<?php
/* Widget Content */

$points = new Pod('points');
$points->page = 1;
$points->search = false;
$points->findRecords("(login+registration+comments+deals+like_fb+feedback+vote+referral) DESC, p.modified ASC", 5);
$i = 0;
while($points->fetchRecord()){
   $name = $points->get_field('user.name');
   $name = explode(' ',$name);
   $user[$i]['name'] = $name[0];
   $user[$i]['slug'] = $points->get_field('user.slug');
   $user[$i]['total_points'] = $points->get_field('login') + $points->get_field('registration') + $points->get_field('comments') + $points->get_field('deals') + $points->get_field('like_fb') + $points->get_field('feedback') + $points->get_field('vote') + $points->get_field('referral');
   $user[$i]['modified'] = $points->get_field('modified');
   $i++;
}

echo '<div class="leader_wrap">';
foreach($user as $val)
{
  echo '<div class="member_link">
  <a rel="nofollow" href="'.BUZZR_URL.'/member/'.$val['slug'].'">'.$val['name'].'</a>
  </div>
  <div class="member_points">'.$val['total_points'].' Points</div>';
}
echo '</div><div style="clear: both;"></div><a href="http://dev.buzzr.in/get-points">...Get Points</a>';

/* Widget Content */
?>

<?php
/* Widget Logic */ 
!is_pod_page('dailydeals/*') && !is_pod_page('dailydeals')
/* Widget Logic */ 
?>
